<?php
defined('IN_PHPCMS') or exit('No permission resources.');
pc_base::load_app_class('admin','admin',0);
pc_base::load_sys_class('form','',0);

/**
 * 留言模块
 */
class analysis extends admin {
	private $logDb;
	public $siteid;
	public $catid = 7;
	function __construct() {
        parent::__construct();
		$this->logDb = pc_base::load_model('epaper_detail_log_model');
		$this->siteid = $this->get_siteid();
	}
	
	public function list() {

		$date = safe_replace(trim($_GET['date']??''));
		$title = trim(safe_replace($_GET['title']??''));

		$page = $_GET['page']?:1;

		$limit = 20;

		$offset = ($page - 1) * $limit;

		$w = '';
		if($date)
			$w .= $w ? "and `epaper_date`='$date'" : "`epaper_date`='$date'";
		if($title)
			$w .= $w ? "and `epaper_title` like '%".$title."%'" : "`epaper_title` like '%".$title."%'";

		// $datas = $this->logDb->listinfo($w,'id desc',$_GET['page']);
		
		$sql = '`epaper_id` as id,epaper_date,epaper_title,created_time,count(*) as hits';
		$datas = $this->logDb->select($w,$sql,$offset.','.$limit,'epaper_date desc,epaper_id desc,created_time desc','epaper_id');

		$one = $this->logDb->get_one($w,'count(DISTINCT epaper_id) as num');
		$pages = pages($one['num'], $page, $limit);
		
        // $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=epaper&c=message&a=add\', title:\'添加数字报\', width:\'780\', height:\'500\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', '添加数字报');
		include $this->admin_tpl('analysis_list');
    }

}
